﻿using System;
using System.Collections.Generic;

using System.Text;
using System.Data;
namespace HZ.Supervise.BLL
{
    /// <summary>
    /// 处方单
    /// </summary>
    public class BLL_Prescription : HZ.Supervise.IBLL.IBLL_Prescription
    {

        /// <summary>
        /// 查询补贴情况
        /// </summary>
        /// <param name="stwhere"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public DataTable GetHospitaleNoPrescrip(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetHospitaleNoPrescrip(stwhere, currentPage, pagesize, out totalRecord);
        }
        /// <summary>
        /// 根据条件查询出可补贴的处方单
        /// </summary>
        /// <returns></returns>
        public DataTable GetHospitaleTB_Prescription(string where)
        {
            return DAL.DAL_Prescription.GetHospitaleTB_Prescription(where);
        }
         /// <summary>
        /// 根据条件查询结算单
        /// </summary>
        /// <param name="stwhere"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public DataTable GetAll(string stwhere, int currentPage, int pagesize, out int totalRecord) 
        {
            return DAL.DAL_Prescription.GetAll(stwhere, currentPage, pagesize, out totalRecord);
        }
        /// <summary>
        /// 获取医院未发放的处方单
        /// </summary>
        /// <param name="stwhere"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public DataTable GetHospitaleNoPrescrip1(string stwhere)
        {
            return DAL.DAL_Prescription.GetHospitaleNoPrescrip1(stwhere);
        }
        // /// <summary>
        /////获取Prescrip信息
        ///// </summary>
        ///// <param name="obj"></param>
        ///// <param name="currentPage"></param>
        ///// <param name="pagesize"></param>
        ///// <param name="totalRecord"></param>
        ///// <returns></returns>
        //public  DataTable GetSubsidyTable(string where, int currentPage, int pagesize, out int totalRecord) 
        //{
        //    DataTable dt = new DataTable();
        //    return dt;
        //   // return DAL.DAL_Prescription.GetSubsidyTable(where,currentPage, pagesize, out  totalRecord);
        //}
        /// <summary>
        ///获取Prescrip信息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public IList<HZ.Supervise.Model.Subsidy> GetSubsidyTable(object obj, int currentPage, int pagesize, out int totalRecord)
        {
            return HZ.Data.DAL_Helper.GetPagedModel<HZ.Supervise.Model.Subsidy>(obj, currentPage, pagesize, out  totalRecord);
        }
        /// <summary>
        /// 更新基要补贴
        /// </summary>
        /// <param name="SQL"></param>
        /// <returns></returns>
        public int UpdtePEssentialDrugsAmount(string SQL)
        {
            return DAL.DAL_Prescription.UpdtePEssentialDrugsAmount(SQL);
        }
        /// <summary>
        /// 获取补贴
        /// </summary>
        /// <param name="stwhere"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public DataTable GetSubsidy(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetSubsidy(stwhere, currentPage, pagesize, out totalRecord);
        }
        public DataTable GetSubsidyInfo(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetSubsidyInfo(stwhere, currentPage, pagesize, out totalRecord);
        }
        /// <summary>
        /// 获取补贴处方单
        /// </summary>
        /// <param name="stwhere"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public DataTable GetHospitalePrescripdeail(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetHospitalePrescripdeail(stwhere, currentPage, pagesize, out totalRecord);
        }
        public DataTable GetHospitalePrescrioDetail2(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetHospitalePrescrioDetail2(stwhere, currentPage, pagesize, out totalRecord);
        }
        public DataTable GetHospitaleTB_PrescriptionDetail(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetHospitaleTB_PrescriptionDetail(stwhere, currentPage, pagesize, out totalRecord);
        }
        //显示明细
        public DataTable GetHospitalePrescrioDetail2(string stwhere)
        {
            return DAL.DAL_Prescription.GetHospitalePrescrioDetail2(stwhere);
        }
        /// <summary>
        /// 查询明细
        /// </summary>
        /// <param name="stwhere"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public DataTable GetHospitaleSubsidyDetail(string stwhere, int currentPage, int pagesize, out int totalRecord)
        {
            return DAL.DAL_Prescription.GetHospitaleSubsidyDetail(stwhere, currentPage, pagesize, out totalRecord);

        }
        /// <summary>
        /// 获取提交数据
        /// </summary>
        /// <param name="stwhere"></param>
        /// <returns></returns>
        public DataTable GetSubmitData(string stwhere)
        {
            return DAL.DAL_Prescription.GetSubmitData(stwhere);
        }
        /// <summary>
        /// 更新提交数据状态
        /// </summary>
        /// <param name="stupdate1">更新为1的ID</param>
        /// <param name="strupdate0">更新为 0 的ID</param>
        /// <returns></returns>
        public int UpdateSubmitDataControlID(string stupdate1, string strupdate0, string struserid)
        {
            return DAL.DAL_Prescription.UpdateSubmitDataControlID(stupdate1, strupdate0, struserid);
        }

        /// <summary>
        /// 补助报表
        /// </summary>
        /// <param name="sqlwhere"></param>
        /// <param name="sqlgroup"></param>
        /// <param name="tpye">0:医院已确认补助,1:已补助</param>
        /// <returns></returns>
        public DataTable GetSubsidyStatistics(string sqlwhere)
        {
            return DAL.DAL_Prescription.GetSubsidyStatistics(sqlwhere);
        }
        /// <summary>
        /// 批量更新Subsidy
        /// </summary>
        /// <param name="SubsidyList"></param>
        /// <returns></returns>
        public int UpdateSubsidyStateBacth(IList<HZ.Supervise.Model.Subsidy> SubsidyList)
        {
            return DAL.DAL_Prescription.UpdateSubsidyState(SubsidyList);
        }
        /// <summary>
        ///获取SubsidyDetail信息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public IList<HZ.Supervise.Model.SubsidyDetail> GetSubsidyDetailTable(object obj, int currentPage, int pagesize, out int totalRecord)
        {
            return HZ.Data.DAL_Helper.GetPagedModel<HZ.Supervise.Model.SubsidyDetail>(obj, currentPage, pagesize, out  totalRecord);
        }
        /// <summary>
        /// 批量删除SubsidyDetail
        /// </summary>
        /// <param name="SubsidyList"></param>
        /// <returns></returns>
        public int DeleteSubsidyDetailBacth(IList<HZ.Supervise.Model.SubsidyDetail> SubsidyDetailList)
        {
            return DAL.DAL_Prescription.DeleteSubsidyDetailBacth(SubsidyDetailList);
        }
        /// <summary>
        /// 批量删除Subsidy
        /// </summary>
        /// <param name="SubsidyList"></param>
        /// <returns></returns>
        public int DeleteSubsidyBacth(IList<HZ.Supervise.Model.Subsidy> SubsidyList)
        {
            return DAL.DAL_Prescription.DeleteSubsidyBacth(SubsidyList);
        }
        /// <summary>
        /// 批量更新SubsidyDetail
        /// </summary>
        /// <param name="SubsidyDetailList"></param>
        /// <returns></returns>
        public int UpdateSubsidyDetailBacth(IList<HZ.Supervise.Model.SubsidyDetail> SubsidyDetailList)
        {
            return DAL.DAL_Prescription.UpdateSubsidyDetailBacth(SubsidyDetailList);
        }
        /// <summary>
        /// 获取GetSubsidyList
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="currentPage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalRecord"></param>
        /// <returns></returns>
        public IList<HZ.Supervise.Model.Subsidy> GetSubsidyList(object obj, int currentPage, int pagesize, out int totalRecord)
        {
            return HZ.Data.DAL_Helper.GetPagedModel<HZ.Supervise.Model.Subsidy>(obj, currentPage, pagesize, out  totalRecord);
        }
        /// <summary>
        /// 向Subsidy表里添加SubsidyDetail
        /// </summary>
        /// <param name="SubsidyDetailList"></param>
        /// <returns></returns>
        public int AddSubsidyDetailToSubsidy(IList<HZ.Supervise.Model.SubsidyDetail> SubsidyDetailList)
        {
            return DAL.DAL_Prescription.AddSubsidyDetailToSubsidy(SubsidyDetailList);
        }
         /// <summary>
        /// 更新或插入结算单或处方单明细
        /// </summary>
        /// <param name="subsidy">结算单</param>
        /// <param name="prescriotionList">处方单集合</param>
        /// <param name="i">参数若为0时添加结算单，若为其他时更新结算单</param>
        /// <returns></returns>
        public  int UpdateAll(Model.Subsidy subsidy, IList<Model.Prescription> prescriotionList, int i) 
        {
            return DAL.DAL_Prescription.UpdateAll(subsidy, prescriotionList,i);
        }
    }
}
